// 用户相关的api 接口
import request from '@/utils/requiest'

// 因为 order 所有的内容都需要验证 token, 登录后使用
// 所以我们在请求拦截器内书写 token 的添加

// 1. 添加一个订单
export const addOrderApi = (userid: string) => request.post('/order/addOrder', { userid })

// 2. 获取订单列表
export const orderInfoApi = (userid: string) => request.post('/user/orderlist', { userid })

// 3. 修改地址信息
interface MyAddressInfo {
  userid: string,
  name: string,
  tel: string,
  province: string,
  city: string,
  county: string,
  addressDetail: string,
  time: string,
}
export const updateAddressInfoApi = (info: MyAddressInfo) => request.post('/order/updateOrderAddress', info)

// 4. 确认订单
export const confirmOrderApi = (userid: string, time: string) => request.get('/order/confirmOrder', {
  params: { userid, time }
})
